"""
33 - Dars
"""


FIL = open('komputer/1-topshiriq.txt', 'r', encoding='utf-8')
TEXT1 = FIL.read(2)
TEXT2 = FIL.read(8)
print(FIL.encoding, TEXT1, TEXT2, sep='\n')
TEXT = FIL.read()
FIL.close()
print(TEXT)

FIL = open('komputer/2-topshiriq.txt', 'a', encoding='utf-8')
FIL.write('Telefonlar')
FIL.close()

FIL = open('komputer/2-topshiriq.txt', 'r', encoding='utf-8')
print(FIL.read())
FIL.close()

LINES1 = ['Shaftoli 1', 'Olma 2']
FFFF = open('file.txt', 'a', encoding='utf-8')
for i in LINES1:
    FFFF.write(i)
FFFF.writelines(LINES1)
FFFF.writelines(f'{i}\n' for i in LINES1)
FFFF.close()

print('########################')

FN1 = open('file.txt', 'r', encoding='utf-8')
for line in FN1:
    print(line, end='')
FN1.close()

print('#########################')
LINES = ['Og\'abek Abdumuradov ', '11 yosh.', ' 5-sinfda']
FILLAR = open('daftar.txt', 'w', encoding='utf-8')
FILLAR.writelines(f'{i}\n' for i in LINES)
FILLAR.close()
print(FILLAR)
print(LINES)
